package me.spring.cloud.common.components.oss.cloud.strategy;

import me.spring.cloud.common.components.oss.cloud.CloudStorageService;
import me.spring.cloud.common.components.oss.cloud.util.OssSourceSet;
import me.spring.cloud.common.components.oss.cloud.util.OssSourceUtil;
import org.springframework.context.annotation.Bean;

/**
 * 该抽象类必须由子类实现其抽象方法，用于负责获取云存储连接信息获取
 * <p>
 */
public abstract class OssSourceGetStrategy {

  public abstract CloudStorageService getOssService(String keyOssSource);

  @Bean(name = OssSourceUtil.OSS_SOURCE_GETSTRATEGY)
  public OssSourceGetStrategy getOssSourceReadStrategy() {
    return this;
  }

  public void removeOssService(String keyOssSource) {
    OssSourceSet.removeTargetOssSourcesMap(keyOssSource);
  }
}